"""
装饰器 主要用来防止重名
"""

from functools import wraps
def sqlalchemy_context():
    def add_context(func):
        @wraps(func)
        def do_job(*args, **kwargs):
            # app.app_context().push()
            result = func(*args,**kwargs)
            return result
        return do_job
    return add_context



# #手机短信
from ronglian_sms_sdk import SmsSDK
accId = '8aaf07087bc82708017bf7aae5000e27'   #8aaf07087bc82708017bf7aae5000e27
accToken = 'f53d9d4740ed40adb6829538dc940709' #f53d9d4740ed40adb6829538dc940709
appId = '8aaf07087bc82708017bf7aae5e00e2e'  #8aaf07087bc82708017bf7aae5e00e2e
import json
def send_message(mobile,code,time):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    mobile = mobile
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return 1
    return 2